package com.gh.demo.mapper;

import com.gh.demo.entity.GoodsType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface Receivemappers extends JpaRepository<GoodsType,Integer> {
    @Modifying
    @Transactional
    @Query(value = "update goods_type set numbers=(numbers-?1) where type=?2 ",nativeQuery = true)
    void updates(Integer number,String type);

    //先查一下
    @Query(value = "select * from goods_type ",nativeQuery = true)
    List<GoodsType> selectWar();
}
